package com.milo.web.entity;

import lombok.Data;
import org.hibernate.validator.constraints.CreditCardNumber;

import javax.validation.constraints.*;

/**
 * @author: milogenius
 * @create: 2019/5/17 15:07 
 * @description:
 **/
@Data
public class PersonForm {

    @NotNull
    @Size(min=2, max=30)
    private String name;

    @NotNull
    @Min(18)
    private Integer age;

    @NotBlank(message = "street 不能为空")
    private String street;

    /**
     * 信用卡号
     */
    @CreditCardNumber(message = "不正确的信用卡号")
    private String ccNumber;

    /**
     * 匹配正则表达式
     */
    @Pattern(regexp = "^[A-Za-z0-9\\u4e00-\\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$",message = "邮箱格式不正确")
    private String email;

    @Digits(integer = 3,fraction = 0,message = "无效的ccVV")
    private String ccVV;
}